package com.shangxian.giveithome.service.impl;


import com.shangxian.giveithome.entity.ActivityByUser;
import com.shangxian.giveithome.entity.ActivityStatus;
import com.shangxian.giveithome.mapper.ActivityFeiMapper;
import com.shangxian.giveithome.service.ActivityFeiService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;



@Service
public class ActivityFeiServiceImpl implements ActivityFeiService {


    @Resource
    private ActivityFeiMapper activityFeiMapper;

    /**
     * 根据机构id查询活动数据
     *
     * @param mr_id
     * @return
     */
    @Override
    public List<ActivityStatus> queryByMechanismId(Long mr_id) {
        //查询进行中的集合
        List<ActivityStatus> activitiesIng = activityFeiMapper.queryByIdIng(mr_id);
        if (CollectionUtils.isEmpty(activitiesIng)) {
            return new ArrayList<>();
        }
        return activitiesIng;
    }

    /**
     * 根据活动id集合查询活动信息 -用户查询
     *
     * @param acs
     * @return
     */
    @Override
    public List<ActivityByUser> queryByActivityUser(List<Long> acs) {
        return activityFeiMapper.queryActivityByUser(acs);
    }
}
